﻿using System.IO;
using System.Text;
using System;

namespace Citi.Helpers
{
    public class ConsoleInFile : TextWriter
    {
        string filePath = null;

        public ConsoleInFile(string filePath)
        {
            this.filePath = filePath;
        }

        public override void Write(char value)
        {
            base.Write(value);

            try
            {
                File.AppendAllText(filePath, value.ToString());
            }
            catch { }
        }

        public override Encoding Encoding
        {
            get { return System.Text.Encoding.UTF8; }
        }
    }
}
